// StpLibrary - by Steve T. Pham
// http://www.geocities.com/stevetpham

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using SteveTPham.QueryAnything.Utilities;
//using StpLibrary.Utilities;

namespace SteveTPham.QueryAnything.Controls
{
	public class ExtendedFlowLayoutPanel : FlowLayoutPanel
	{
		public ExtendedFlowLayoutPanel()
		{
			base.Dock = DockStyle.Fill;
			base.AutoScroll = true;
			base.Scroll += new ScrollEventHandler(ExtendedFlowLayoutPanel_Scroll);
		}

		private void ExtendedFlowLayoutPanel_Scroll(object sender, ScrollEventArgs e)
		{
			try
			{
				switch (e.ScrollOrientation)
				{
					case ScrollOrientation.HorizontalScroll:
						base.HorizontalScroll.Value = e.NewValue;
						break;
					case ScrollOrientation.VerticalScroll:
						base.VerticalScroll.Value = e.NewValue;
						break;
				}
			}
			catch (Exception ex)
			{
				FormUtil.WinException(ex, "FlowLayoutPanel Scroll");
			}
		}
	}
}
